package praktikumid.w07.p5;

import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Font;

import javax.swing.*;

public class FrameExample extends JFrame {

	public static void main(String[] args) {
		
		JFrame frame = new FrameExample();
		frame.setTitle("Java GUI Example");
		frame.setVisible(true);
		frame.setDefaultCloseOperation(EXIT_ON_CLOSE);
		frame.setLocation(300, 300);
		frame.setSize(400, 400);
		
		JPanel leftPanel = new JPanel();
		leftPanel.setLayout(new BoxLayout(leftPanel, BoxLayout.Y_AXIS)); // .X_AXIS
		leftPanel.setBackground(new Color(0, 100, 0)); // Color.GREEN
		
		leftPanel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
		
		frame.getContentPane().add(leftPanel, BorderLayout.WEST); // .NORTH, .EAST
		
		JButton jbtn = new JButton("Button text");
		jbtn.setFont(new Font("Arial", Font.BOLD, 18));
		leftPanel.add(jbtn);
		leftPanel.add(Box.createRigidArea(new Dimension(20, 20)));
		leftPanel.add(new JButton("Second button"));
		leftPanel.add(Box.createRigidArea(new Dimension(20, 20)));
		leftPanel.add(new JButton("Third button"));
		
		JPanel rightPanel = new JPanel();
		rightPanel.setLayout(new BoxLayout(rightPanel, BoxLayout.Y_AXIS)); // .X_AXIS
		rightPanel.setBackground(Color.WHITE);
		
		rightPanel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
		
		frame.getContentPane().add(rightPanel, BorderLayout.CENTER);
		
		JLabel label1 = new JLabel("tekst tekst tekst tekst tekst");
		label1.setFont(new Font("Arial", Font.BOLD, 48));
		rightPanel.add(label1);
		
		frame.pack();
	
		frame.repaint();
	}
}
